<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>权限管理</title>
    <#include "../common/link.ftl">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <c:set var="currentMenu" value="permission"/>
    <#assign  currentMenu="permission">
    <#include "../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>权限管理</h1>
        </section>
        <section class="content">
            <div class="box" >
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                <@shiro.hasPermission name="permission:reload">
                    <a href="javascript:;" class="btn btn-success btn_reload" style="margin: 10px;">
                        <span class="glyphicon glyphicon-repeat"></span>  重新加载
                    </a>
                </@shiro.hasPermission>

                </form>
                <script>
                    $(function () {
                        $('.btn_reload').click(function () {
                            $.post('/permission/reload.do',function (data) {
                                if(data.success){
                                    $.messager.alert('温馨提示',data.msg);
                                    location.href ='/permission/list.do';
                                }else{
                                    $.messager.alert('温馨提示',data.msg);
                                }
                            })

                        });

                    })
                </script>
                <table class="table table-striped table-hover" >
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>权限名称</th>
                        <th>权限表达式</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <#list pageInfo.list as permission>
                       <tr>
                           <td>${permission_index + 1}</td>
                           <td>${permission.name}</td>
                           <td>${permission.expression}</td>
                           <td>
                               <@shiro.hasPermission name="permission:delete">
                                   <a data-url='/permission/delete.do' data-id='${permission.id}'
                                      class="btn btn-danger btn-xs btn-delete">
                                       <span class="glyphicon glyphicon-trash"></span> 删除
                                   </a>
                               </@shiro.hasPermission>

                           </td>
                       </tr>
                    </#list>
                    </table>
                <!--分页-->
            <#include "../common/page.ftl">
            </div>
        </section>
    </div>
    <#include "../common/footer.ftl">
</div>
</body>
</html>
